#include"Interlude.h"
 
  
bool Interlude::attach_function() {
    //インタールード
	//https://vndb.org/v3195

  const BYTE bytes[] = {
    0x83,0xEC,0x10,
	0x8B,0x44,0x24,0x24,
	0x3D,0x20,0x80,0x00,0x00,
	0xC7,0x04,0x24,0xE0,0xE0,0xE0,0x00,
	0xC7,0x44,0x24,0x04,0xE0,0xE0,0xE0,0x20,
	0xC7,0x44,0x24,0x08,0xE0,0xE0,0xE0,0x40,
	0xC7,0x44,0x24,0x0C,0xE0,0xE0,0xE0,0x80,
  };
  ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);

  if (addr == 0)return false;  
  HookParam hp;
  hp.address = addr ;
  hp.offset=stackoffset(5);
  hp.type = CODEC_ANSI_BE ;
  
  return NewHook(hp, "Interlude");
}  